﻿

using BootstrapBlazor.Components;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using TrackSystem.Entities.Dtos.Equip;
using TrackSystem.Entities.Models;

namespace TrackSystem.Entities.Dtos.Logic
{
    public class LogicDto
    {
        /// <summary>
        /// 统一标识符
        /// </summary>
        [Key]
        [Display(Name = "ID")]
        [AutoGenerateColumn(Order = 1)]
        public int Id { get; set; }

        /// <summary>
        /// 通道名称
        /// </summary>
        [Required]
        [Display(Name = "名称")]
        [AutoGenerateColumn(Order = 10, Filterable = true, Searchable = true)]
        public required string Name { get; set; }

        /// <summary>
        /// 控制回路描述
        /// </summary>
        [Display(Name = "描述")]
        [AutoGenerateColumn(Order = 20, Filterable = true, Searchable = true)]
        public string? Description { get; set; }

        /// <summary>
        /// 控制回路使能
        /// </summary>
        [Display(Name = "使能")]
        [AutoGenerateColumn(Order = 30)]
        public bool Enabled { get; set; }

        /// <summary>
        /// 逻辑运行条件表达式
        /// </summary>
        [Display(Name = "条件表达式")]
        [AutoGenerateColumn(Order = 40)]
        public string? ConditionFormula { get; set; }

        /// <summary>
        /// 计算表达式
        /// </summary>
        [Display(Name = "逻辑程序")]
        [AutoGenerateColumn(Order = 50)]
        public string? ClacateFormula { get; set; }

        /// <summary>
        /// 运算结果输出变量, 可以写多个，用空格隔开即可
        /// </summary>
        [Display(Name = "结果列表")]
        [AutoGenerateColumn(Order = 60)]
        public string? ResultReg { get; set; }

        /// <summary>
        /// 是否计算结果发生改变才更新输出变量
        /// </summary>
        [Display(Name = "结果刷新方式")]
        [AutoGenerateColumn(Order = 70)]
        public bool UpdateWhenChanged { get; set; }

        /// <summary>
        /// 该传感器关联的设备ID
        /// </summary>
        [Display(Name = "设备ID")]
        [AutoGenerateColumn(Order = 80)]
        public int equipId { get; set; }

        /// <summary>
        /// 该传感器关联的设备描述
        /// </summary>
        [Display(Name = "设备信息")]
        [AutoGenerateColumn(Order = 90)]
        public EquipDto Equip { get; set; }
    }
}
